// 修改
export const setItem = (key: string, value: any[]) => {
  try {
    const data = JSON.stringify(value);
    localStorage.setItem(key, data);
  } catch (error) {
    throw new Error('not json');
  }
};

// 查询
export const getItem = (key: string) => {
  if (localStorage.getItem(key)) {
    return JSON.parse(localStorage.getItem(key) || '');
  }
};
